const User = require('../models/user');

class UserHandler {
  // 查询所有
  async findAll() {
    const result = await User.findAll()
    return result
  }
  async findUser(id) {
    const result = await User.findOne({
      where: {
        id
      }
    })
    return result
  }

  async createUser(params) {
    const result = await User.create(params)
    return result
  }
  async deleteUser(id) {
    const result = await User.destroy({
      where: {
        id
      }
    })
    return result
  }
  async updateUser(params, id) {
    const result = await User.update(params, {
      where: {
        id
      }
    })
    return result
  }
}
module.exports = new UserHandler()